<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt"  prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>OA协同办公系统</title>
<link href="css/table.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/file.js"></script>
<script type="text/javascript">
function loadFile(val){
		var fileId=$("#fileArray").val();
		if(fileId!=''&&fileId!='null'){
			var param={"fileArray":fileId};
			$.post("getFileList.action",param,function(data) {
				var list=data.fileList;
				for(var i=0;i<list.length;i++){
					$("#"+val).prepend("<li>"+list[i].name+"&nbsp;<a href=\"downLoadFile.action?fileId="+list[i].id+"\">下载</a></li>");
		        }
			},"json");
		}
	}
	window.onload=function(){
		loadFile('filetable');
	}
	
function addOpinionTask(){
	var content = $("#content").val();
	if(content==''||content=='null'){
		alert("请添加回复信息");
		return;
	}
	document.addOpinionTaskForm.action="addOpinionTask.action";
	document.addOpinionTaskForm.submit();
	alert("回复成功");
	window.close();
	window.opener.location.reload();
}
$(function(){
	var taskId = $("#taskId").val();
	var param={"taskId":taskId};
	$.post("getOpinionTask.action",param,function(data){
		var list =data.opinionList;
		var info="";
		for(var i=0;i<list.length;i++){
			info+="<table style=\" width: 100%\">";
				info+="<tr><td align=\"left\" >&nbsp;"+list[i].content+"</td></tr>";
				info+="<tr><td align=\"right\">"+list[i].userName+"&nbsp;"+(list[i].addTime.year-100+2000)+"-"+(list[i].addTime.month+1)+"-"+(list[i].addTime.date)+"<hr size=\"1\"/></td></tr></table>";
		}
		$("#opintask").html(info);
	},"json");
});	
</script>
</head>
<body>
<input type="hidden" id="fileArray" value="${task.fileId}">
<table align="center" border="0" cellpadding="0" cellspacing="0" width="98%">
  <tbody>
  <tr>
    <td style="background: url('image/wsoa_window_002.gif');" width="1"></td>
    <td style="background: url('image/wsoa_window_002.gif');"><table border="0" cellpadding="0" cellspacing="0">
      <tbody><tr>
        <td align="center" style="background: url('image/wsoa_window_002.gif');" width="10"><img src="image/center_19.gif"></td>
        <td align="center" style="background: url('image/wsoa_window_002.gif');"></td>
        <td></td>
        </tr>
    </tbody>
    </table></td>
    <td style="background: url('image/wsoa_window_002.gif');" width="1"></td>
  </tr>
  <tr>
    <td style="background: url('image/wsoa_window_010.gif');"  width="1">&nbsp;</td>
    <td>

<table width="100%" height="15"><tr><td></td></tr></table>
	<table style="width: 100%;" align="center">
	  <tr>
		<td>
			<table style=" width: 100%;height: 180px"   class="table5 bgcolor5" align="center" style="TABLE-LAYOUT:fixed">
					<tr>
						<td class="table5 bgcolor5" align="right" width="80px">
							 日程时间
						</td>
						<td class="table5">
						<fmt:formatDate value="${task.startTime}" type="date" pattern="yyyy-MM-dd"/>
							 至
						<fmt:formatDate value="${task.endTime}" type="date" pattern="yyyy-MM-dd"/>
						</td>
							<td class="table5 bgcolor5"  align="right" width="80px">
							循环方式
						</td>
						<td class="table5">
							<c:if test="${task.cycle=='week'}">
						按星期
					</c:if>
					<c:if test="${task.cycle=='month'}">
						按月
					</c:if>
					&nbsp;
					<c:if test="${task.cycle=='week'}">
						<c:if test="${task.week==1}">
						星期日
						</c:if>
						<c:if test="${task.week==2}">
						星期一
						</c:if>
						<c:if test="${task.week==3}">
						星期二
						</c:if>
						<c:if test="${task.week==4}">
						星期三
						</c:if>
						<c:if test="${task.week==5}">
						星期四
						</c:if>
						<c:if test="${task.week==6}">
						星期五
						</c:if>
						<c:if test="${task.week==7}">
						星期六
						</c:if>
					</c:if>
					&nbsp;
					<c:if test="${task.cycle=='month'}">
						${task.monthDay}号
					</c:if>
						</td>
					</tr>
					<tr>
						<td class="table5 bgcolor5" align="right" width="80px">
							办理时间
						</td>
						<td class="table5">
							${task.startHour}时：${task.startMunite}分
						</td>
						<td class="table5 bgcolor5" align="right" width="80px">
							短信提醒
						</td>
						<td class="table5"> 
							 提前${task.alertTime}小时
						</td>
					
					</tr>
					<tr>
						<td  class="table5 bgcolor5" align="right" width="80px">
							 日程主题
						</td>
						<td  class="table5" colspan="3">
							 ${task.title} 
						</td>
					</tr>
					<tr height="50px">
						<td  class="table5 bgcolor5" align="right" width="80px">
							 日程内容
						</td>
						<td  class="table5" colspan="3">${task.content }</td>
					</tr>
					
					<tr >
						<td class="table5 bgcolor5" align="right" width="80px">
							知会对象
						</td>
						<td class="table5" colspan="3">
						 ${names } 
						</td>
					</tr>
					<tr>
				<td align="right" width="60px">附&nbsp;&nbsp;&nbsp;&nbsp;件 </td>
				<td colspan="3" class="tdline">&nbsp; 
					<ul  id="filetable">
          				 </ul>
				</td>
				</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td>
				<table  style=" width: 100%" class="table5 bgcolor1"  align="center" style="TABLE-LAYOUT:fixed">
					<tr>
					<td align="right" width="60">回&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;复 </td>
					<td id="opintask">
						
					</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td>
			<form action="" method="post" name="addOpinionTaskForm" id="addOpinionTaskForm">
				<input type="hidden" value="${task.id }" id="taskId" name="opinion.taskId" />
				<table style=" width: 100%"   class="table5 bgcolor5" align="center" style="TABLE-LAYOUT:fixed">
					<tr><td align="right"  width="60">回&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;复 </td>
						<td >
							<textarea id="content" name="opinion.content" rows="6" style="width: 99%" title="该输入项的最大长度为500!"></textarea>
						</td>
					</tr>
				</table>
				</form>
			</td>
		</tr>
		<tr><td align="center"><input class="button_02" type="button" value="回复" onclick="addOpinionTask()" >&nbsp;<input class="button_02" type="button" value="取消" onclick="window.close()" > </td></tr>
	</table>
	
	 </td>
<td style="background: url('image/wsoa_window_006.gif');"  width="1">&nbsp;</td></tr>
  <tr>
    <td height="1" width="1"><img src="image/wsoa_window_009.gif" height="16" width="14"></td>
    <td style="background: url('image/wsoa_window_008.gif');" height="1"></td>
    <td height="1" width="1"><img src="image/wsoa_window_007.gif" height="16" width="12"></td>
  </tr>
</tbody>
</table>
</body>
</html>